using MediatR;
using RBAC.ErrorCode;
using System.ComponentModel.DataAnnotations;

namespace RBAC.Write.Api.Application.Command.ArrivalInspection
{
    /// <summary>
    /// 修改到货检验命令（主表+明细+附件全量覆盖）
    /// </summary>
    public class UpdateArrivalInspectionCommand : IRequest<APIResult<long>>
    {
        /// <summary>
        /// 主键ID（必填）
        /// </summary>
        [Required]
        public long Id { get; set; }

        /// <summary>
        /// 检验单号（可改可不改）
        /// </summary>
        public string? DocCode { get; set; }

        [Required]
        public string Subject { get; set; } = string.Empty;

        [Required]
        public string InspectionDate { get; set; } = string.Empty;

        public string? Inspector { get; set; }
        public string? Department { get; set; }
        public string? PurchaseOrderNo { get; set; }
        public string? Remark { get; set; }

        // 采购信息（可选）
        public string? SupplierId { get; set; }
        public string? SupplierName { get; set; }
        public string? PurchaseDate { get; set; }
        public string? PurchaseContact { get; set; }
        public string? ContactPhone { get; set; }
        public string? Buyer { get; set; }
        public string? PurchaseDept { get; set; }
        public string? ProjectName { get; set; }

        [MinLength(1, ErrorMessage = "明细不能为空")]
        public List<CreateArrivalInspectionItemDto> Items { get; set; } = new();

        public List<CreateArrivalInspectionAttachmentDto> Attachments { get; set; } = new();

        public string? UpdateUser { get; set; }
    }
}
